/*
 * Project: Sudoku Explainer
 * Copyright (C) 2006-2007 Nicolas Juillerat
 * 
 * Project: Sudoku Hint Engine for Android
 * Copyright (C) 2010-2013 Emanuel Moecklin
 * 
 * Available under the terms of the Lesser General Public License (LGPL)
 */
package com.onegravity.sudoku.solver.checks;

import com.onegravity.sudoku.solver.HintResource;
import com.onegravity.sudoku.solver.HintType;
import com.onegravity.sudoku.solver.core.WarningHint;
import com.onegravity.sudoku.solver.data.Grid;
import com.onegravity.sudoku.solver.util.HtmlLoader;

/**
 * Hint that contains the solution of a Sudoku.
 */
public class SolutionHint extends WarningHint {

	private static final long serialVersionUID = -7186860285089023645L;
	
	private final Grid grid;
    private final Grid solution;

    public SolutionHint(Grid grid, Grid solution) {
    	super(grid);
        this.grid = grid;
        this.solution = solution;
    }

    @Override
    public String toString() {
		return HintResource.SOLUTION.toString();
    }

    @Override
    public String getHintHtml(HintType hintType) {
        String result = HtmlLoader.loadHtml(HintResource.SOLUTION.hint());
        return HtmlLoader.format(result);
    }

    @Override
    public Grid apply() {
        solution.copyTo(grid);
        return grid;
    }

}